package com.example.base.app;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class AppHandlerServer {

    private Map<String,AppHandler> appHandlerMap;

    public void addAppHandler(String appName, AppHandler appHandler){
        if(appHandlerMap==null){
            appHandlerMap=new ConcurrentHashMap<>();
        }
        appHandlerMap.put(appName,appHandler);
    }

    public AppHandler getAppHandlerByAppName(String appName){
        if(appHandlerMap==null){
            return null;
        }
        return appHandlerMap.get(appName);
    }

}
